package nl.ceasaro.jeslee.webapp.example.action;

import org.apache.struts2.config.Namespace;
import org.apache.struts2.config.Result;
import org.apache.struts2.config.NullResult;
import org.apache.struts2.views.freemarker.FreemarkerResult;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionSupport;

/**
 * Created by IntelliJ IDEA.
 * User: cees
 * Date: Oct 11, 2008
 * Time: 12:04:27 AM
 * <p>
 * Simple action to demonstrate struts2 annotations.
 * </p>
 */
@Namespace (value = "/example")
@Result (name = Action.SUCCESS,
      value = "/example/annotatedHello.jsp",
      type = FreemarkerResult.class)
public class ExampleAnnotatedAction extends ActionSupport
{
   private static final long serialVersionUID = 4399893507886798898L;
   public static final String MESSAGE = "Struts is up and running including annotations...";

   @Override
   public String execute() throws Exception
   {
      setMessage(MESSAGE);
      return SUCCESS;
   }

   public String directToMethod() throws Exception
   {
      setMessage("Struts calls this method directly.");
      return SUCCESS;
   }
   
   private String message;

   public void setMessage(String message)
   {
      this.message = message;
   }

   public String getMessage()
   {
      return message;
   }

}